package com.higgins.lawapp.client.settings.components;

import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.CheckBox;
import com.higgins.lawapp.client.settings.model.DataSourceModel;


public class DataSourceExecuteCheckBox extends CheckBox	implements ValueChangeHandler	{
	private DataSourceModel dataSourceModel;
	
	public DataSourceExecuteCheckBox(DataSourceModel dataSourceModel)	{
		this.dataSourceModel = dataSourceModel;
		this.addValueChangeHandler(this);
		this.setText("Register for Execution");
	}

	@Override
	public void onValueChange(ValueChangeEvent event) {
		dataSourceModel.setDataSourceExecute(this.getValue());
		if (this.getValue())
			dataSourceModel.beginFullDataCollection();
	}
}
